package com.jokey.vue.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jokey.vue.model.Hr;
import com.jokey.vue.model.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author: JokeyZheng
 * @email: zhengjingfeng@ruqimobility.com
 * @created: 2021/11/25 21:02
 * @version: v1.0.0
 */
@Component
public interface HrMapper extends BaseMapper<Hr> {

    /**
     * 查询HR角色
     *
     * @param id
     * @return
     */
    @Select("<script>" +
            "select r.* from role r,hr_role hrr where hrr.`r_id`=r.`id` and hrr.`hr_id`=#{id}" +
            "</script>")
    List<Role> getHrRolesById(Integer id);

    /**
     * 获取所有HR信息
     *
     * @param hrId
     * @param name
     * @return
     */
    List<Hr> getAllHrs(@Param("hrId") Integer hrId, @Param("name") String name);

}
